package com.isunland.managesystem.ui;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import com.isunland.managesystem.R;

/**
 * Created by wangyanan on 2016/6/24.
 */
public class MessageDialog extends DialogFragment {
  private static final String EXTRA_VALUE =
      "com.isunland.managesystem.ui.MessageDialog.EXTRA_VALUE";

  public static MessageDialog newInstence(String message) {
    Bundle bundle = new Bundle();
    bundle.putSerializable(EXTRA_VALUE, message);
    MessageDialog dialog = new MessageDialog();
    dialog.setArguments(bundle);
    return dialog;
  }

  @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
    String message = (String) getArguments().getSerializable(EXTRA_VALUE);
    AlertDialog.Builder builderSingle = new AlertDialog.Builder(getActivity());

    return builderSingle.setTitle(R.string.hintMessage)
        .setMessage(message)
        .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {

          @Override public void onClick(DialogInterface dialog, int which) {
            // Auto-generated method stub

          }
        })
        .create();
  }
}
